package org.aom.util;

import java.util.Map;

import org.operamasks.faces.component.html.impl.UIIFrame;
import org.operamasks.faces.component.layout.impl.UIWindow;
import org.operamasks.faces.util.Browser;

/**
 * 这个工具类放一些和ManageBean相关并且和组件相关的工具方法
 * 
 * @author Saya
 * 
 */
public class ManageBeanUtil {

	private static String SELECTED_MODULE_ID = "selectedModuleId";
	private static String ACTION_NAME = "action";

	/**
	 * 打开弹出窗口时的工具方法
	 * @param selectedModuleId
	 * @param actionName
	 * @param OperationFrame
	 * @param url
	 * @param OperationDialog
	 * @param width
	 * @param height
	 */
	public static void openDialog(Long selectedModuleId, String actionName,
			UIIFrame OperationFrame, String url, UIWindow OperationDialog,
			Integer width, Integer height) {
		Map<String, Object> session = FaceUtil.getSessionMap();
		session.put(SELECTED_MODULE_ID, selectedModuleId);
		session.put(ACTION_NAME, actionName);
		OperationFrame.load(url);
		OperationDialog.setWidth(width);
		OperationDialog.setHeight(height);
		OperationDialog.show();
	}
	/**
	 * 在为选则任何记录妄图进行操作时给出的警告
	 */
	public static void noSelectWarn() {
		Browser.execClientScript("window.alert('请选择一条记录！');");
		//Browser.execClientScript("Ext.Msg.alert('警告','请选择一条记录！',function(btn){});");
		return;
	}

}
